package com.example.zjx8969.myapplication.net;


/*
public abstract class NetCallBackWrapper<T> extends Callback<T> {
    @Override
    public T parseNetworkResponse(Response response, int id) throws Exception {
        String mResponseStr = response.body().string();
        try {
            JSONObject object = new JSONObject(mResponseStr);
            int code = object.optInt("code");
            if (code != 0) {
                throw new IllegalArgumentException(mResponseStr);
            }
            String dataString = object.getString("data");
            if (getClass().getGenericSuperclass() instanceof ParameterizedType) {
                Class<T> entityClass = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
                if (entityClass == String.class) {
                    return (T) dataString;
                }
                Gson gson = new Gson();
                return gson.fromJson(dataString, entityClass);
            } else {
                return (T) dataString;
            }

        } catch (JsonSyntaxException e) {
            e.printStackTrace();
            return null;
        }
    }

    @Override
    public abstract void onError(Call call, Exception e, int id);

    @Override
    public abstract void onResponse(T response, int id);
}
*/
